<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      账号：<input type="text" v-model="formData.zh" />
      <br />

      <!-- 同一组单选按钮，绑定同一个数据即可 -->
      性别：
      <label>
        男
        <input type="radio" value="male" v-model="formData.xb" />
      </label>
      <label>
        女
        <input type="radio" value="female" v-model="formData.xb" />
      </label>

      <br />

      爱好：
      <label>
        吃饭
        <input type="checkbox" value="chifan" v-model="formData.ah" />
      </label>
      <label>
        睡觉
        <input type="checkbox" value="shuijiao" v-model="formData.ah" />
      </label>
      <label>
        打豆豆
        <input type="checkbox" value="dadoudou" v-model="formData.ah" />
      </label>

      <br />

      所属专业：
      <select v-model="formData.sszy">
        <option value="js">JS</option>
        <option value="java">JAVA</option>
        <option value="ui">UI</option>
      </select>

      <br />
      备注：
      <textarea v-model="formData.bz"></textarea>
      <br />
      <button @click="onSubmit">提交</button>
    </div>
    <script src="../vue.js"></script>
    <script>
      var app = new Vue({
        el: '#app',
        data: {
          formData: {
            zh: '',
            xb: '',
            ah: [],
            sszy: '',
            bz: '',
          },
        },
        methods: {
          onSubmit() {
            console.log(JSON.stringify(this.formData, null, 2));
          },
        },
      });
    </script>
  </body>
</html>
